<?php

namespace app\traits;

use app\service\auth;
use Illuminate\Database\Capsule\Manager as DB;

trait orderinvalid
{
    use stocksale;

    // 订单取消或关闭返还
    private function invalid($order, $type)
    {
        // 如果有优惠券， 返还优惠券
        if ($order->coupons_id > 0) {
            // $coupon = UserCoupons::where('id', $order->coupons_id)->find();
            // if ($coupon) {
            //     $coupon->usetime = null;
            //     $coupon->save();
            // }
        }

        // 预销量预库存只有 商城订单有
        if ($order['type'] == 'goods') {
            // // 扣除预拼团人数
            // $this->grouponCacheBackNum($order);
            // // 判断扣除预销量
            // $this->cacheBackSale($order);
        }

        $this->realFallbackStockSale($order);
    }
}